<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .taobao {
            width: 520px;
            height: 280px;
            background-color: deepskyblue;
            margin: 100px auto;
            position: relative;
        }

        .taobao img {
            width: 100%;
            height: 100%;
        }

        a {
            text-decoration: none;
            color: #050505;
        }

        li {
            list-style: none;
        }

        .arr-l,
        .arr-r {
            position: absolute;
            top: 50%;
            width: 20px;
            height: 30px;
            line-height: 30px;
            margin-top: -15px;
            background-color: rgba(0, 0, 0, .2);
            color: white;
        }

        .arr-l {
            left: 0;
            border-top-right-radius: 15px;
            border-bottom-right-radius: 15px;
        }

        .arr-r {
            right: 0;
            text-align: right;
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
        }

        .arr-l:hover,
        .arr-r:hover {
            background-color: rgba(0, 0, 0, .4);
        }

        .circle {
            position: absolute;
            left: 50%;
            bottom: 15px;
            width: 70px;
            margin-left: -35px;
            height: 13px;
            border-radius: 7px;
            background-color: rgba(255, 255, 255, .3);
        }

        .circle li {
            float: left;
            width: 8px;
            height: 8px;
            border-radius: 4px;
            background-color: lightpink;
            margin: 3px;
            cursor: pointer;
        }

        li.current {
            background-color: #ff5000;
        }

        .v-enter,
        .v-leave-to {
            opacity: 0;
            transform: translateX(80px);
        }

        .v-enter-active,
        .v-leave-active {
            transition: all 0.4s ease;
        }
    </style>
</head>

<body>
    <div class="taobao" id="box">
        <a href="#" class="arr-l"> &lt; </a>
        <a href="#" class="arr-r"> &gt; </a>
        <img :src="imagePath" alt="">
        <ul class="circle">
            <li v-for="i in 5" @click="toggle($event)" :key="i" :id="i"></li>
        </ul>
    </div>
    <script>
        var vm = new Vue({
            el: "#box",
            data: {
                imagePath: "upload/pic1.jpg"
            },
            methods: {
                toggle(e) {
                    console.log('this', this)
                    let id = e.target.getAttribute('id');
                    this.imagePath = `upload/pic${id}.jpg`;
                    let lis = e.target.parentNode.children;
                    console.log(lis);
                    for (let j = 0; j < lis.length; ++j) {
                        lis[j].className = '';
                    }
                    e.target.className = "current";
                }
            },
            mounted() {
                let li = document.querySelector('li');
                li.className = 'current';
            }
        })
    </script>
</body>

</html>